﻿using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class TaskItem : MonoBehaviour {
	[SerializeField]
	protected string iName;
	/// <summary>
	/// 物品名称
	/// </summary>
	public string Name{ get{ return iName; } }

	// <summary>
	// 物品对应的预设体
	// </summary>
	//public GameObject prefab{
	//	get{ return ItemManager.ItemMan.getPrefabInAllObj (iName);}
	//}

	//[SerializeField]
	//protected bool consumable;
	// 是否为消耗品
	//public bool Consumable{get{return consumable;}}

	/// <summary>
	/// UI显示时摄像机到物体的距离
	/// </summary>
	//public float cameraDistance = 1f;

	/// <summary>
	/// UI显示时摄像机到物体的距离
	/// </summary>
	public float showScale = 1f;
	/// <summary>
	/// 任务物品特有的介绍文字
	/// </summary>
	public string Intro;

	public static TaskItem addTaskItemTo(GameObject target, TaskItem srcTaskItem){
		TaskItem newTI = target.AddComponent<TaskItem> ();
		newTI.iName = srcTaskItem.iName;
		newTI.Intro = srcTaskItem.Intro;

		return newTI;
	}

	/// <summary>
	/// 交互函数，当物体与玩家产生交互时
	/// </summary>
	/// <param name="hit">Hit.</param>
	void OnInteraction(RaycastHit hit){
		BackpackManager._instance.addItem(this);
	}
}
